﻿<Window x:Class="Wpf3D.GridWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:local="clr-namespace:Wpf3D"
        Title="GridWindow" Height="400" Width="400">
    <Window.Resources>
        <local:ColorConvert x:Key="myConvert"/>
        <Style x:Key="item" TargetType="{x:Type ListViewItem}">
            <Setter Property="Background">
                <Setter.Value>
                    <Binding RelativeSource="{RelativeSource Self}" Converter="{StaticResource myConvert}"/>
                </Setter.Value>
            </Setter>            
        </Style>
    </Window.Resources>
    <Grid>
        <ListView ItemContainerStyle="{StaticResource ResourceKey=item}" HorizontalAlignment="Left" Margin="0,0,0,0" Width="380" VerticalAlignment="Top" Name="listview">
            <ListView.View>
                <GridView>
                    <GridView.Columns>
                        <GridViewColumn Header="Name" DisplayMemberBinding="{Binding Name}"/>
                        <GridViewColumn Header="Age" DisplayMemberBinding="{Binding Age}"/>
                    </GridView.Columns>
                </GridView>
            </ListView.View>
        </ListView>
        <Button Content="删除一行" Click="Button_Click" Margin="289,332,12,0" />

    </Grid>
</Window>
